package com.nine.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.nine.dao.TopicFpaDao;
import com.nine.entity.PageSort;
import com.nine.entity.TopicFpa;
import com.nine.service.TopicFpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @Author:LouFangRui
 * @Date:2022/6/29 17:46
 */
@Service
public class TopicFpaServiceImpl implements TopicFpaService {
	@Autowired
	private TopicFpaDao topicFpaDao;
	/**
	 *查询and模糊查询
	 * */
	@Override
	public List<TopicFpa> selectAllQues(TopicFpa topicFpa) {

		List<TopicFpa> topicFpaList = topicFpaDao.selectAllQues(topicFpa);
		return topicFpaList;
	}
	/**
	 *删除与批量删除
	 * */
	@Override
	public int deleteById(String[] topicId) {
		int i = topicFpaDao.deleteById(topicId);
		return i;
	}
	/**
	 *添加
	 * */
	@Override
	public int addFpaQuestion(TopicFpa topicFpa) {
		int i = topicFpaDao.addFpaQuestion(topicFpa);
		return i;
	}
	/**
	 *修改
	 * */
	@Override
	public int updateFpaQuestion(TopicFpa topicFpa) {
		int i = topicFpaDao.updateFpaQuestion(topicFpa);
		return i;
	}
	/**
	 *分页查询
	 * */
	@Override
	public Page selectAllQues(PageSort pageSort, TopicFpa topicFpa) {
		//开始分页
		Page<TopicFpa> page= PageHelper.startPage(pageSort.getPage(),pageSort.getLimit());
		List<TopicFpa> topicFpaList = topicFpaDao.selectAllQues(topicFpa);
		Page listWithPage=(Page) topicFpaList;
		return listWithPage;
	}
}
